package cn.uc.ucgc.community.upgrade.conf;

import java.io.File;
import java.util.List;

/**
 * property/xml类型文件，需要做替换的任务
 * 
 * @author yuyj@ucweb.com
 * @createDate 2014-3-7
 *
 */
public class ReplaceJob {
    private JobType type;
    /*原文件路径-绝对路径*/
    private File srcPath;
    /*目的文件路径-绝对路径*/
    private File dstPath;
    /*需要替换的keys*/
    private List<ReplaceItem> replaceItems;

    public ReplaceJob(JobType type, File srcPath, File dstPath, List<ReplaceItem> replaceItems) {
        this.type = type;
        this.srcPath = srcPath;
        this.dstPath = dstPath;
        this.replaceItems = replaceItems;
    }

    public JobType getType() {
        return type;
    }

    public File getSrcPath() {
        return srcPath;
    }

    public File getDstPath() {
        return dstPath;
    }

    public List<ReplaceItem> getReplaceItems() {
        return replaceItems;
    }

    public static class ReplaceItem {
        /*原文件中，需要获取对应值的key*/
        private String srcKey;
        /*目标文件中，需要替换对应值的key，可以不填写，默认同原key*/
        private String dstKey;

        public ReplaceItem(String srcKey, String dstKey) {
            super();
            this.srcKey = srcKey;
            this.dstKey = dstKey;
        }

        public String getSrcKey() {
            return srcKey;
        }

        public String getDstKey() {
            return dstKey;
        }
    }
}
